package com.ztgf.order.service;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.ztgf.order.common.config.YmlConfig;
import com.ztgf.order.mapper.OrderReturnCommodityRefundMapper;
import com.ztgf.order.models.bo.OrderReturnCommodityRefundSaveBO;
import com.ztgf.order.models.dto.OrderReturnCommodityRefundDTO;
import com.ztgf.order.models.service.IOrderReturnCommodityRefundService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;

import javax.annotation.Resource;

/**
 * 售后订单退款表控制器
 *
 * @author YUE
 * @Date 2020-08-20 11:29:08
 */
@DubboService
public class OrderReturnCommodityRefundServiceImpl extends ServiceImpl<OrderReturnCommodityRefundMapper, OrderReturnCommodityRefundDTO> implements IOrderReturnCommodityRefundService{

    @Resource
    private YmlConfig ymlConfig;

    @Override
    public boolean add(OrderReturnCommodityRefundSaveBO saveBO) {
        OrderReturnCommodityRefundDTO dto = new OrderReturnCommodityRefundDTO();
        BeanUtils.copyProperties(saveBO,dto);
        Long id = ymlConfig.getPkId();
        dto.setId(id);
        return this.insert(dto);
    }

    @Override
    public Long addAndReturnId(OrderReturnCommodityRefundSaveBO saveBO) {
        OrderReturnCommodityRefundDTO dto = new OrderReturnCommodityRefundDTO();
        BeanUtils.copyProperties(saveBO,dto);
        Long id = ymlConfig.getPkId();
        dto.setId(id);
        this.insert(dto);
        return id;
    }
}
